package com.garlic.face.jlf.transaction.shop;


import com.garlic.face.jlf.transaction.bean.VipBean;

/**
 * Created by lyq on 2018/6/1.
 * Email: lyqcy1337@163.com
 */

public class VipInfo {

    private static VipInfo vipInfo = null;

    public static VipInfo getInstance() {
        if (null == vipInfo) {
            synchronized (VipInfo.class) {
                if (null == vipInfo) {
                    vipInfo = new VipInfo();
                }
            }
        }
        return vipInfo;
    }

    /**
     * 清空数据
     */
    public void clearVipData() {
        if (vipBean != null) {
            vipBean.setVipNumber("");
            vipBean.setCardnumber("");
            vipBean.setPoints(0.0);
            vipBean = null;
        }
        isLogin = false;
    }

    private boolean isLogin; // 判断用户是否登陆成功
    private VipBean vipBean; // 会员信息

    public boolean isLogin() {
        return isLogin;
    }

    public void setLogin(boolean login) {
        isLogin = login;
    }

    public VipBean getVipBean() {
        if (null == vipBean) { // 防止意外错误
            vipBean = new VipBean();
            vipBean.setVipNumber("");
            vipBean.setCardnumber("");
            vipBean.setPoints(0.0);
        }
        return vipBean;
    }

    public void setVipBean(VipBean vipBean) {
        this.vipBean = vipBean;
    }
}
